package day05;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;

import javax.swing.plaf.synth.SynthSpinnerUI;

import day02.Title;

public class Paper {
	ArrayList newList=new ArrayList();//定义一个存题目的数组
	ArrayList<ArrayList<Integer>> newanwserlist=new ArrayList<ArrayList<Integer>>();//定义一个村题目答案的属数组
	private Shujuku shujuku=new Shujuku();
	private ClientContext clientcontext;
	
	public Paper(){
		xuanTi();
	}

	
	public ArrayList<ArrayList<Integer>> getNewanwserlist() {
		return newanwserlist;
	}


	public void setNewanwserlist(ArrayList<ArrayList<Integer>> newanwserlist) {
		this.newanwserlist = newanwserlist;
	}


	public void xuanTi() {
		for(int i=1;i<11;i++) {
			List<Title> list=shujuku.getTitle().get(i);
			Random random=new Random();//随机数的对象
			List<Integer> tempList=new ArrayList<Integer>();//建立一个存放索引的集合
			int temp=0;
			for(int j=0;j<2;j++){
				temp=random.nextInt(list.size());//将产生的随机数作为被抽list的索引
				if(!tempList.contains(temp)){
					tempList.add(temp);
					newList.add(list.get(temp));
					newanwserlist.add(list.get(temp).getAnwser());
				}else{
					j--;
				}	
			}
		
		}
//		System.out.println(newanwserlist);
//		System.out.println(newList.size());
		
	}
	
	public Shujuku getShujuku() {
		return shujuku;
	}

	public void setShujuku(Shujuku shujuku) {
		this.shujuku = shujuku;
	}

	public ClientContext getClientcontext() {
		return clientcontext;
	}

	public void setClientcontext(ClientContext clientcontext) {
		this.clientcontext = clientcontext;
	}
	public static void main(String[] args) {
		Paper pp=new Paper();
		System.out.println(pp.newanwserlist);
	}


		

	 
 
}
